﻿package extend.php
{
    import flash.events.*;
    import flash.net.*;

    public class PHPGetter extends Object
    {

        public function PHPGetter()
        {
            return;
        }// end function

        public static function getUrlValue(param1:String, param2:Object = null, param3:Function = null) : void
        {
            var loader:URLLoader;
            var completeHandler:Function;
            var url:* = param1;
            var data:* = param2;
            var callBack:* = param3;
            completeHandler = function (event:Event) : void
            {
                if (callBack != null)
                {
                    callBack.call(null, loader.data);
                }
                loader.removeEventListener(Event.COMPLETE, completeHandler);
                loader = null;
                return;
            }// end function
            ;
            loader = new URLLoader();
            loader.dataFormat = URLLoaderDataFormat.TEXT;
            loader.addEventListener(Event.COMPLETE, completeHandler);
            var request:* = new URLRequest(url);
            request.method = "post";
            request.data = data;
            loader.load(request);
            return;
        }// end function

    }
}
